package com.softWang.system.po;

import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.softWang.common.base.BasePO;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 系统菜单表
 */
@TableName(value = "system_menu", autoResultMap = true)
@KeySequence("system_menu_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库，可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SystemMenu extends BasePO {

    @ApiModelProperty(value = "主键id")
    @TableId
    private Long id;


    @ApiModelProperty(value = "名称，长度为60")
    @NotBlank(message = "mname不能为空")
    @Size(max = 60,message="mname长度为60")
    private String mname;

    @ApiModelProperty(value = "父id")
    @NotNull(message = "pid不能为空")
    private Long pid;

    @ApiModelProperty(value = "树id路径，最大长度为100位")
    private String treecode;

    @ApiModelProperty(value = "类型{分类:1,菜单:2,按钮:3}")
    @NotNull(message = "type不能为空")
    private Integer type;

    @ApiModelProperty(value = "页面路由或按钮标识，长度为60")
    @Size(max = 60,message="mkey长度为60")
    private String mkey;

    @ApiModelProperty(value = "后台权限标识如system:user:query，长度为60")
    @Size(max = 60,message="permission长度为60")
    private String permission;

    @ApiModelProperty(value = "菜单图标，长度为60")
    @Size(max = 60,message="icon长度为60")
    private String icon;

    @ApiModelProperty(value = "状态,0:正常,1:停用")
    private Integer state;

    @ApiModelProperty(value = "路由完整path，长度为255")
    @Size(max = 255,message="url长度为255")
    private String url;

    @ApiModelProperty(value = "排序值，越小越靠前")
    private Integer sort;

    /**
     * 类型枚举
     */
    public enum Type {
        /**
         * 分类
         */
        Kind(1),
        /**
         * 菜单
         */
        Menu(2),
        /**
         * 按钮
         */
        Button(3);


        private Integer code;

        Type(Integer code) {
            this.code = code;
        }
        public Integer getCode() {
            return this.code;
        }

    }

    /**
     * 状态枚举
     */
    public enum State {
        /**
         * 正常
         */
        NORMAL(0),
        /**
         * 停用
         */
        DISABLE(1);


        private Integer code;

        State(Integer code) {
            this.code = code;
        }
        public Integer getCode() {
            return this.code;
        }

    }


}